/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.GUI.treasury;

import ac.settings.dataModel;
import ac.ui.controls.PCLFrame;
import ac.uitls.propertiesOperation;
import java.awt.Component;
import javax.swing.JPanel;

/**
 *
 * @author ismail
 */
public class Installment_items extends PCLFrame {

    /**
     * Creates new form Installment_items
     */
    ac.engin.treasury.Installment_items i = new ac.engin.treasury.Installment_items();
    String Bid = "";
    propertiesOperation po = new propertiesOperation();

    public Installment_items(String itemID, String Bid) {
        initComponents();
        this.Bid = Bid;
        i.IndexID = Integer.parseInt(itemID);
        i.TabelString = dataModel.TABLE_installment_items;
        i.dataComponents = new Component[]{jsp_amount, jd_date};
        i.dataSaveFields = new String[]{"amount", "date"};
        i.ActionsButtons.put("edit", jbt_edit);

        if (i.getStatus(itemID).equalsIgnoreCase("1")) {

            this.setTitle(po.getWord("label.paydone"));

            pCLPanel1.setVisible(false);

            i.panels = new JPanel[]{
                pCLPanel1
            };
            i.EnablePanels(false);

        } else {
            this.setTitle(po.getWord("label.paynotdone"));

        }
        if (itemID == null) {

            this.dispose();
        } else {

            i.FrameDataupdate(i.IndexID);
            i.editStep1();

        }
        onLoad();

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pCLPanel1 = new ac.ui.controls.PCLPanel();
        jsp_amount = new ac.ui.controls.PCLMoney();
        pCLLabel25 = new ac.ui.controls.PCLLabel();
        jd_date = new ac.ui.controls.PCLDate();
        pCLLabel19 = new ac.ui.controls.PCLLabel();
        pCLToolbar2 = new ac.ui.controls.PCLToolbar();
        jbt_edit = new ac.ui.controls.PCLButton();
        jXLabel1 = new org.jdesktop.swingx.JXLabel();
        jbt_cancel = new ac.ui.controls.PCLButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        pCLLabel25.setText("jlb_amount");

        jd_date.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jd_dateMouseClicked(evt);
            }
        });
        jd_date.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jd_dateActionPerformed(evt);
            }
        });
        jd_date.addHierarchyListener(new java.awt.event.HierarchyListener() {
            public void hierarchyChanged(java.awt.event.HierarchyEvent evt) {
                jd_dateHierarchyChanged(evt);
            }
        });

        pCLLabel19.setText("jlb_date");

        pCLToolbar2.setRollover(true);

        jbt_edit.setType("edit");
        jbt_edit.setFocusable(false);
        jbt_edit.setText("jbt_edit");
        jbt_edit.setVerticalTextPosition(3);
        jbt_edit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_editActionPerformed(evt);
            }
        });
        pCLToolbar2.add(jbt_edit);

        jXLabel1.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        jXLabel1.setIconTextGap(0);
        jXLabel1.setMaximumSize(new java.awt.Dimension(50, 14));
        jXLabel1.setPreferredSize(new java.awt.Dimension(50, 14));
        pCLToolbar2.add(jXLabel1);

        jbt_cancel.setType("cancel");
        jbt_cancel.setFocusable(false);
        jbt_cancel.setText("jbt_cancel");
        jbt_cancel.setVerticalTextPosition(3);
        jbt_cancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_cancelActionPerformed(evt);
            }
        });
        pCLToolbar2.add(jbt_cancel);

        javax.swing.GroupLayout pCLPanel1Layout = new javax.swing.GroupLayout(pCLPanel1);
        pCLPanel1.setLayout(pCLPanel1Layout);
        pCLPanel1Layout.setHorizontalGroup(
            pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pCLToolbar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(pCLPanel1Layout.createSequentialGroup()
                        .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jsp_amount, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(pCLLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pCLPanel1Layout.createSequentialGroup()
                                .addComponent(pCLLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(jd_date, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE))))
                .addContainerGap())
        );
        pCLPanel1Layout.setVerticalGroup(
            pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pCLLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jsp_amount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jd_date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(pCLToolbar2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pCLPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jd_dateMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jd_dateMouseClicked

    }//GEN-LAST:event_jd_dateMouseClicked

    private void jd_dateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jd_dateActionPerformed

    }//GEN-LAST:event_jd_dateActionPerformed

    private void jd_dateHierarchyChanged(java.awt.event.HierarchyEvent evt) {//GEN-FIRST:event_jd_dateHierarchyChanged

    }//GEN-LAST:event_jd_dateHierarchyChanged

    private void jbt_editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_editActionPerformed

        i.dataSaveValues = ac.ui.utils.getDataFromComss(i.dataComponents);
        i.editStep2(true, false);
        Installment.updateindex(Bid);

        this.dispose();


    }//GEN-LAST:event_jbt_editActionPerformed

    private void jbt_cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_cancelActionPerformed
        this.dispose();
    }//GEN-LAST:event_jbt_cancelActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Installment_items.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Installment_items.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Installment_items.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Installment_items.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Installment_items(null, null).setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.jdesktop.swingx.JXLabel jXLabel1;
    private ac.ui.controls.PCLButton jbt_cancel;
    private ac.ui.controls.PCLButton jbt_edit;
    private ac.ui.controls.PCLDate jd_date;
    private ac.ui.controls.PCLMoney jsp_amount;
    private ac.ui.controls.PCLLabel pCLLabel19;
    private ac.ui.controls.PCLLabel pCLLabel25;
    private ac.ui.controls.PCLPanel pCLPanel1;
    private ac.ui.controls.PCLToolbar pCLToolbar2;
    // End of variables declaration//GEN-END:variables
}
